<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
	<head>

		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/back/css/bootstrap.min.css">
		<script src="${pageContext.request.contextPath}/back/js/jquery-3.3.1.js"></script>
		<script src="${pageContext.request.contextPath}/back/js/bootstrap.min.js"></script>
		<link rel="stylesheet" href="${pageContext.request.contextPath}/back/css/btn.css" />
	</head>
	<body style="background-color: #f0f9fd;text-align: center;">
	
		<div style="font-size:25px">类别管理</div><hr/>
		<div style="margin-bottom: 10px;">
			<div class="button btn-p" onclick="location.href='${pageContext.request.contextPath}/back/category/add-first.jsp'">添加一级类别&raquo;</div>
			<div class="button btn-p" onclick="location.href='${pageContext.request.contextPath}/category/toAddSecondCategory'">添加二级类别&raquo;</div>
		</div>
		<table bordercolor='#898E90' align='center' border='3px' cellpadding='10px' cellspacing="0px" width="800px">
			<tr bgcolor='lightblue'>
				<td>Id</td>
				<td>类别名</td>
				<td>所属类别</td>
				<td>级别</td>
				<td>操作</td>
			</tr>
			<c:forEach var="category" items="${requestScope.pageInfo.list}">
			<tr>
				<td>${category.categoryId}</td>
				<td>${category.categoryName}</td>
				<td>${category.parent.categoryName}</td>
				<td>${category.levels}</td>
				<td>
					<div id="d1" class="button" onclick="location.href='${pageContext.request.contextPath}/category/deleteCategory?categoryId=${category.categoryId}&levels=${category.levels}&pageNum=${pageInfo.pageNum}' ">删除 &raquo;</div>
				</td>
			</tr>
			</c:forEach>
		</table><br/>
		<span style="font-size: 25px;margin: 5px">
			当前第${pageInfo.pageNum}页,共${pageInfo.pages}页,总${pageInfo.total}条记录
		</span>
		<nav aria-label="Page navigation">
			<ul class="pagination">
				<li><a href="${pageContext.request.contextPath}/category/selectAllCategoryByPages?pageNum=1">首页</a></li>
				<li>
					<a href="${pageContext.request.contextPath}/category/selectAllCategoryByPages?pageNum=${pageInfo.prePage}" aria-label="Previous">
						<span aria-hidden="true">&laquo;</span>
					</a>
				</li>
				<c:forEach items="${pageInfo.navigatepageNums}" var="page_Num">
					<c:if test="${page_Num==pageInfo.pageNum}">
						<li class="active"><a href="${pageContext.request.contextPath}/category/selectAllCategoryByPages?pageNum=${page_Num}">${page_Num}</a></li>
					</c:if>
					<c:if test="${page_Num!=pageInfo.pageNum}">
						<li><a href="${pageContext.request.contextPath}/category/selectAllCategoryByPages?pageNum=${page_Num}">${page_Num}</a></li>
					</c:if>
				</c:forEach>
				<li>
					<a href="${pageContext.request.contextPath}/category/selectAllCategoryByPages?pageNum=${pageInfo.pageNum+1}" aria-label="Next">
						<span aria-hidden="true">&raquo;</span>
					</a>
				</li>
				<li><a href="${pageContext.request.contextPath}/category/selectAllCategoryByPages?pageNum=${pageInfo.pages}">尾页</a></li>
			</ul>
		</nav>
	<script>
		$(function () {
			$("td").prop("align","center");
		});
		var a='${param.message}';
		if(a!=null&&a.length>0){
			alert('${param.message}');
		}
	</script>
	</body>
</html>



